# Contributor: Dmitry Zakharchenko <dmitz@disroot.org>
# Maintainer: Dmitry Zakharchenko <dmitz@disroot.org>
pkgname=steamguard-cli
pkgver=0.9.6
pkgrel=0
pkgdesc="Command line utility for setting up and using Steam Mobile Authenticator"
url="https://github.com/dyc3/steamguard-cli"
# ring
arch="all !ppc64le !s390x !riscv64"
license="GPL-3.0-or-later"
makedepends="cargo cargo-auditable openssl-dev"
subpackages="$pkgname-bash-completion $pkgname-zsh-completion"
source="$pkgname-$pkgver.tar.gz::https://github.com/dyc3/steamguard-cli/archive/refs/tags/v$pkgver.tar.gz
	openssl.patch
	"
options="net" # cargo fetch

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release

	mkdir -p completions
	target/release/steamguard completion --shell bash > completions/steamguard
	target/release/steamguard completion --shell zsh > completions/_steamguard
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/steamguard -t "$pkgdir"/usr/bin/

	install -Dm644 completions/steamguard \
		-t "$pkgdir"/usr/share/bash-completion/completions/
	install -Dm644 completions/_steamguard \
		-t "$pkgdir"/usr/share/zsh/site-functions/
}

sha512sums="
31c5eb2b796554ad46e719aff5a2d285bbea49f248aa6f8d9f60a07234ea00ec521f49471e78177e624f8940ce4e55749f066aedef73316d9392554850489573  steamguard-cli-0.9.6.tar.gz
aceda15ade3deaf14b4fdbce4b849acfa89855cfd306ba9577f4e280fa175ffe1233776c1e13f372462b6e60292907e6a1a6aceec6b51a90d3067aa22132a31a  openssl.patch
"
